import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:jinke/utils/component/filter_view/index.dart';
import 'package:jinke/utils/util.dart';

import '../index.dart';

/// hello
class ProListHeader extends GetView<ProListController> {
  const ProListHeader({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var state = controller.state;
    return Column(
      children: [
        GetBuilder<ProListController>(
          builder: (_) => Container(
            color: Colors.white,
            child: TabBar(
              controller: state.tabCtrl,
              isScrollable: false,
              unselectedLabelStyle: TextStyle(fontSize: 14.sp),
              labelStyle:
                  TextStyle(fontSize: 15.sp, fontWeight: FontWeight.bold),
              labelColor: ColorsUtil.blue,
              indicatorPadding: EdgeInsets.symmetric(horizontal: 20.r),
              unselectedLabelColor: ColorsUtil.title,
              indicatorSize: TabBarIndicatorSize.label,
              tabs: state.tabTitles
                  .asMap()
                  .map(
                    (key, value) => MapEntry(
                      key,
                      Tab(
                        text: '${value.name}(${value.count})',
                      ),
                    ),
                  )
                  .values
                  .toList(),
            ),
          ),
        ),
        separatorLine(),
        Container(
          color: Colors.white,
          child: FilterView(list: state.filterList),
        )
      ],
    );
  }
}
